
<!DOCTYPE HTML>
<html lang="zh-hans" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>浏览器里的本地数据库：IndexedDB · 记录技术文档内容</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="zhengyuliang">
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-sectionx/sectionx.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-splitter/splitter.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-tbfed-pagefooter/footer.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-toggle-chapters/toggle.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search-plus/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-donate/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-anchor-navigation-ex/style/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-chapter-fold/chapter-fold.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-expandable-chapters-small/expandable-chapters-small.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-theme-comscore/test.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="../Vue/7个有用的Vue开发技巧.html" />
    
    
    <link rel="prev" href="../CSS/自适应 flex grid.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="输入并搜索" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        <li class="header">CSS</li>
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    Introduction
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../CSS/18种CSS命名和书写规范.html">
            
                <a href="../CSS/18种CSS命名和书写规范.html">
            
                    
                    18种CSS命名和书写规范
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../CSS/灵活运用CSS开发技巧.html">
            
                <a href="../CSS/灵活运用CSS开发技巧.html">
            
                    
                    灵活运用CSS开发技巧
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../CSS/自适应 flex grid.html">
            
                <a href="../CSS/自适应 flex grid.html">
            
                    
                    自适应 Flex Grid
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">HTML</li>
        
        
    
        <li class="chapter active" data-level="2.1" data-path="浏览器里的本地数据库：IndexedDB.html">
            
                <a href="浏览器里的本地数据库：IndexedDB.html">
            
                    
                    浏览器里的本地数据库：IndexedDB
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">Vue</li>
        
        
    
        <li class="chapter " data-level="3.1" data-path="../Vue/7个有用的Vue开发技巧.html">
            
                <a href="../Vue/7个有用的Vue开发技巧.html">
            
                    
                    7个有用的Vue开发技巧
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.2" data-path="../Vue/Vue this.$router.push、replace、go的区别.html">
            
                <a href="../Vue/Vue this.$router.push、replace、go的区别.html">
            
                    
                    Vue This.$Router.Push、Replace、Go的区别
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.3" data-path="../Vue/Vue 的父组件和子组件生命周期钩子函数执行顺序？.html">
            
                <a href="../Vue/Vue 的父组件和子组件生命周期钩子函数执行顺序？.html">
            
                    
                    Vue 的父组件和子组件生命周期钩子函数执行顺序？
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.4" data-path="../Vue/Vue.set和this.$set应用的场景.html">
            
                <a href="../Vue/Vue.set和this.$set应用的场景.html">
            
                    
                    Vue.Set和This.$Set应用的场景
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.5" data-path="../Vue/vue高级技巧.html">
            
                <a href="../Vue/vue高级技巧.html">
            
                    
                    Vue高级技巧
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.6" data-path="../Vue/从 0 开始手把手带你搭建一套规范的 Vue3.x 项目工程环境.html">
            
                <a href="../Vue/从 0 开始手把手带你搭建一套规范的 Vue3.x 项目工程环境.html">
            
                    
                    从 0 开始手把手带你搭建一套规范的 Vue3.X 项目工程环境
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.7" data-path="../Vue/浅析 vue-router 源码和动态路由权限分配.html">
            
                <a href="../Vue/浅析 vue-router 源码和动态路由权限分配.html">
            
                    
                    浅析 Vue Router 源码和动态路由权限分配
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.8" data-path="../Vue/父组件监听到子组件的生命周期.html">
            
                <a href="../Vue/父组件监听到子组件的生命周期.html">
            
                    
                    父组件监听到子组件的生命周期
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.9" data-path="../Vue/理解Vue.mixin，利用Vue.mixin正确的偷懒.html">
            
                <a href="../Vue/理解Vue.mixin，利用Vue.mixin正确的偷懒.html">
            
                    
                    理解Vue.Mixin，利用Vue.Mixin正确的偷懒
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">JavaScript</li>
        
        
    
        <li class="chapter " data-level="4.1" data-path="../javaScript/5个技巧让你更好的编写 JavaScript(ES6">
            
                <span>
            
                    
                    5个技巧让你更好的编写 JavaScript(ES6) 中条件语句
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.2" data-path="../javaScript/5种常见函数的写法和调用方式.html">
            
                <a href="../javaScript/5种常见函数的写法和调用方式.html">
            
                    
                    5种常见函数的写法和调用方式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.3" data-path="../javaScript/7道javascript题，让你理解基本的javascript.html">
            
                <a href="../javaScript/7道javascript题，让你理解基本的javascript.html">
            
                    
                    7道Javascript题，让你理解基本的Javascript
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.4" data-path="../javaScript/Array.from(">
            
                <span>
            
                    
                    Array.From() 五个超好用的用途
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.5" data-path="../javaScript/ES6汇总资料.html">
            
                <a href="../javaScript/ES6汇总资料.html">
            
                    
                    ES6汇总资料
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.6" data-path="../javaScript/JS开发必须知道的41个技巧.html">
            
                <a href="../javaScript/JS开发必须知道的41个技巧.html">
            
                    
                    JS开发必须知道的41个技巧
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.7" data-path="../javaScript/JavaScript之防抖Debounce和节流Throttle.html">
            
                <a href="../javaScript/JavaScript之防抖Debounce和节流Throttle.html">
            
                    
                    JavaScript之防抖Debounce和节流Throttle
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.8" data-path="../javaScript/JavaScript数组求并集，交集和差集.html">
            
                <a href="../javaScript/JavaScript数组求并集，交集和差集.html">
            
                    
                    JavaScript数组求并集，交集和差集
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.9" data-path="../javaScript/JavaScript的优雅写法.html">
            
                <a href="../javaScript/JavaScript的优雅写法.html">
            
                    
                    JavaScript的优雅写法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.10" data-path="../javaScript/axios知识点.html">
            
                <a href="../javaScript/axios知识点.html">
            
                    
                    Axios知识点
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.11" data-path="../javaScript/javascript核心知识.html">
            
                <a href="../javaScript/javascript核心知识.html">
            
                    
                    Javascript核心知识
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.12" data-path="../javaScript/this、apply、call、bind.html">
            
                <a href="../javaScript/this、apply、call、bind.html">
            
                    
                    This、Apply、Call、Bind
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.13" data-path="../javaScript/前端js常用的60余种工具方法.html">
            
                <a href="../javaScript/前端js常用的60余种工具方法.html">
            
                    
                    前端Js常用的60余种工具方法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.14" data-path="../javaScript/前端异常的捕获与处理.html">
            
                <a href="../javaScript/前端异常的捕获与处理.html">
            
                    
                    前端异常的捕获与处理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.15" data-path="../javaScript/在 JavaScript 中交换值的 10 种方法.html">
            
                <a href="../javaScript/在 JavaScript 中交换值的 10 种方法.html">
            
                    
                    在 JavaScript 中交换值的 10 种方法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.16" data-path="../javaScript/常用的前端JavaScript方法封装.html">
            
                <a href="../javaScript/常用的前端JavaScript方法封装.html">
            
                    
                    常用的前端JavaScript方法封装
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.17" data-path="../javaScript/异步神器Async-await介绍与填坑.html">
            
                <a href="../javaScript/异步神器Async-await介绍与填坑.html">
            
                    
                    异步神器Async Await介绍与填坑
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.18" data-path="../javaScript/灵活运用JS开发技巧.html">
            
                <a href="../javaScript/灵活运用JS开发技巧.html">
            
                    
                    灵活运用JS开发技巧
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.19" data-path="../javaScript/编写高质量可维护的代码：一目了然的注释.html">
            
                <a href="../javaScript/编写高质量可维护的代码：一目了然的注释.html">
            
                    
                    编写高质量可维护的代码：一目了然的注释
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.20" data-path="../javaScript/编写高质量可维护的代码：优化逻辑判断.html">
            
                <a href="../javaScript/编写高质量可维护的代码：优化逻辑判断.html">
            
                    
                    编写高质量可维护的代码：优化逻辑判断
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.21" data-path="../javaScript/编写高质量可维护的代码：优雅命名.html">
            
                <a href="../javaScript/编写高质量可维护的代码：优雅命名.html">
            
                    
                    编写高质量可维护的代码：优雅命名
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.22" data-path="../javaScript/编写高质量可维护的代码：数据建模.html">
            
                <a href="../javaScript/编写高质量可维护的代码：数据建模.html">
            
                    
                    编写高质量可维护的代码：数据建模
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">Life Exp</li>
        
        
    
        <li class="chapter " data-level="5.1" data-path="../life_exp/告别平庸的15个小方法.html">
            
                <a href="../life_exp/告别平庸的15个小方法.html">
            
                    
                    告别平庸的15个小方法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.2" data-path="../life_exp/日志记录.html">
            
                <a href="../life_exp/日志记录.html">
            
                    
                    日志记录
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.3" data-path="../life_exp/程序员的发展方向.html">
            
                <a href="../life_exp/程序员的发展方向.html">
            
                    
                    程序员的发展方向
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.4" data-path="../message/">
            
                <a href="../message/">
            
                    
                    Message
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">Technology</li>
        
        
    
        <li class="chapter " data-level="6.1" data-path="../technology/WebSocket.html">
            
                <a href="../technology/WebSocket.html">
            
                    
                    WebSocket
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.2" data-path="../technology/npm常用命令大全.html">
            
                <a href="../technology/npm常用命令大全.html">
            
                    
                    Npm常用命令大全
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.3" data-path="../technology/智能照明项目说明.html">
            
                <a href="../technology/智能照明项目说明.html">
            
                    
                    智能照明项目说明
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.4" data-path="../technology/规范化git的提交信息.html">
            
                <a href="../technology/规范化git的提交信息.html">
            
                    
                    规范化Git的提交信息
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">Tutorial</li>
        
        
    
        <li class="chapter " data-level="7.1" data-path="../tutorial/Esmap地图详解.html">
            
                <a href="../tutorial/Esmap地图详解.html">
            
                    
                    Esmap地图详解
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.2" data-path="../tutorial/npm镜像切换.html">
            
                <a href="../tutorial/npm镜像切换.html">
            
                    
                    Npm镜像切换
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.3" data-path="../tutorial/发布npm的教程.html">
            
                <a href="../tutorial/发布npm的教程.html">
            
                    
                    发布Npm的教程
            
                </a>
            

            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            本书使用 GitBook 发布
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >浏览器里的本地数据库：IndexedDB</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div class="search-plus" id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <html><head></head><body><div id="anchor-navigation-ex-navbar"><i class="fa fa-navicon"></i><ul><li><span class="title-icon "></span><a href="#&#x6D4F;&#x89C8;&#x5668;&#x91CC;&#x7684;&#x672C;&#x5730;&#x6570;&#x636E;&#x5E93;&#xFF1A;indexeddb"><b>1. </b>&#x6D4F;&#x89C8;&#x5668;&#x91CC;&#x7684;&#x672C;&#x5730;&#x6570;&#x636E;&#x5E93;&#xFF1A;IndexedDB</a></li><ul><li><span class="title-icon "></span><a href="#indexeddb-&#x662F;&#x4EC0;&#x4E48;"><b>1.1. </b>IndexedDB &#x662F;&#x4EC0;&#x4E48;</a></li><li><span class="title-icon "></span><a href="#indexeddb-&#x7684;&#x4E3B;&#x8981;&#x6982;&#x5FF5;"><b>1.2. </b>IndexedDB &#x7684;&#x4E3B;&#x8981;&#x6982;&#x5FF5;</a></li><li><span class="title-icon "></span><a href="#&#x5FEB;&#x901F;&#x8D77;&#x6B65;-indexeddb"><b>1.3. </b>&#x5FEB;&#x901F;&#x8D77;&#x6B65; IndexedDB</a></li><li><span class="title-icon "></span><a href="#&#x53EF;&#x4EE5;&#x63D0;&#x6548;&#x7684;&#x7C7B;&#x5E93;"><b>1.4. </b>&#x53EF;&#x4EE5;&#x63D0;&#x6548;&#x7684;&#x7C7B;&#x5E93;</a></li><li><span class="title-icon "></span><a href="#&#x7ED3;&#x675F;&#x8BED;"><b>1.5. </b>&#x7ED3;&#x675F;&#x8BED;</a></li></ul></ul></div><a href="#&#x6D4F;&#x89C8;&#x5668;&#x91CC;&#x7684;&#x672C;&#x5730;&#x6570;&#x636E;&#x5E93;&#xFF1A;indexeddb" id="anchorNavigationExGoTop"><i class="fa fa-arrow-up"></i></a><h1 id="&#x6D4F;&#x89C8;&#x5668;&#x91CC;&#x7684;&#x672C;&#x5730;&#x6570;&#x636E;&#x5E93;&#xFF1A;indexeddb"><a name="&#x6D4F;&#x89C8;&#x5668;&#x91CC;&#x7684;&#x672C;&#x5730;&#x6570;&#x636E;&#x5E93;&#xFF1A;indexeddb" class="anchor-navigation-ex-anchor" href="#&#x6D4F;&#x89C8;&#x5668;&#x91CC;&#x7684;&#x672C;&#x5730;&#x6570;&#x636E;&#x5E93;&#xFF1A;indexeddb"><i class="fa fa-link" aria-hidden="true"></i></a>1. &#x6D4F;&#x89C8;&#x5668;&#x91CC;&#x7684;&#x672C;&#x5730;&#x6570;&#x636E;&#x5E93;&#xFF1A;IndexedDB</h1>
<p>[TOC]</p>
<h2 id="indexeddb-&#x662F;&#x4EC0;&#x4E48;"><a name="indexeddb-&#x662F;&#x4EC0;&#x4E48;" class="anchor-navigation-ex-anchor" href="#indexeddb-&#x662F;&#x4EC0;&#x4E48;"><i class="fa fa-link" aria-hidden="true"></i></a>1.1. IndexedDB &#x662F;&#x4EC0;&#x4E48;</h2>
<p>&#x5728;&#x73B0;&#x4EE3;&#x6D4F;&#x89C8;&#x5668;&#x7684;&#x672C;&#x5730;&#x5B58;&#x50A8;&#x65B9;&#x6848;&#x4E2D;&#xFF0C;indexedDB &#x662F;&#x4E00;&#x9879;&#x91CD;&#x8981;&#x7684;&#x80FD;&#x529B;&#x7EC4;&#x6210;&#xFF0C; &#x5B83;&#x662F;&#x53EF;&#x4EE5;&#x5728;&#x6D4F;&#x89C8;&#x5668;&#x7AEF;&#x4F7F;&#x7528;&#x7684;&#x672C;&#x5730;&#x6570;&#x636E;&#x5E93;&#xFF0C;&#x53EF;&#x4EE5;&#x5B58;&#x50A8;&#x5927;&#x91CF;&#x6570;&#x636E;&#xFF0C;&#x63D0;&#x4F9B;&#x63A5;&#x53E3;&#x6765;&#x67E5;&#x8BE2;&#xFF0C;&#x8FD8;&#x53EF;&#x4EE5;&#x5EFA;&#x7ACB;&#x7D22;&#x5F15;&#xFF0C;&#x8FD9;&#x4E9B;&#x90FD;&#x662F;&#x5176;&#x4ED6;&#x5B58;&#x50A8;&#x65B9;&#x6848; Cookie &#x6216;&#x8005; LocalStorage &#x65E0;&#x6CD5;&#x63D0;&#x4F9B;&#x7684;&#x80FD;&#x529B;&#x3002;&#x5355;&#x4ECE;&#x6570;&#x636E;&#x5E93;&#x7C7B;&#x578B;&#x6765;&#x770B;&#xFF0C;IndexedDB &#x662F;&#x4E00;&#x4E2A;&#x975E;&#x5173;&#x7CFB;&#x578B;&#x6570;&#x636E;&#x5E93;&#xFF08;&#x4E0D;&#x652F;&#x6301;&#x901A;&#x8FC7; SQL &#x8BED;&#x53E5;&#x64CD;&#x4F5C;&#xFF09;&#x3002;</p>
<h2 id="indexeddb-&#x7684;&#x4E3B;&#x8981;&#x6982;&#x5FF5;"><a name="indexeddb-&#x7684;&#x4E3B;&#x8981;&#x6982;&#x5FF5;" class="anchor-navigation-ex-anchor" href="#indexeddb-&#x7684;&#x4E3B;&#x8981;&#x6982;&#x5FF5;"><i class="fa fa-link" aria-hidden="true"></i></a>1.2. IndexedDB &#x7684;&#x4E3B;&#x8981;&#x6982;&#x5FF5;</h2>
<p>IndexedDB &#x662F;&#x4E00;&#x4E2A;&#x6BD4;&#x8F83;&#x590D;&#x6742;&#x7684; API &#x7EC4;&#x5408;&#xFF0C;&#x5B66;&#x4E60;&#x5B83;&#x7684;&#x8FC7;&#x7A0B;&#x5C31;&#x76F8;&#x5F53;&#x4E8E;&#x5B66;&#x4E60;&#x5B83;&#x7684;&#x5404;&#x4E2A;&#x5BF9;&#x8C61; API &#x63A5;&#x53E3;&#xFF0C;&#x5305;&#x62EC;&#x4EE5;&#x4E0B;&#x8FD9;&#x4E9B;( IDB  &#x6307;&#x5F53;&#x524D;&#x64CD;&#x4F5C;&#x7684;&#x6570;&#x636E;&#x5E93;&#x5B9E;&#x4F8B; )&#xFF1A;</p>
<ul>
<li>&#x6570;&#x636E;&#x5E93;&#xFF1A;IDBDatabase &#x5BF9;&#x8C61;</li>
<li>&#x4ED3;&#x5E93;&#x5BF9;&#x8C61;&#xFF1A; IDBObjectStore &#x5BF9;&#x8C61;</li>
<li>&#x7D22;&#x5F15;&#xFF1A;IDBIndex &#x5BF9;&#x8C61;</li>
<li>&#x4E8B;&#x52A1;&#xFF1A;IDBTransaction &#x5BF9;&#x8C61;</li>
<li>&#x64CD;&#x4F5C;&#x8BF7;&#x6C42;&#xFF1A;IDBRequest &#x5BF9;&#x8C61;</li>
<li>&#x6307;&#x9488;&#xFF1A;IDBCursor &#x5BF9;&#x8C61;</li>
<li>&#x4E3B;&#x952E;&#xFF1A;IDBKeyRange &#x5BF9;&#x8C61;</li>
</ul>
<p>&#x5728;&#x8FD9;&#x4E9B; API &#x4E2D;&#x5305;&#x542B;&#x4E00;&#x4E9B;&#x4E3B;&#x8981;&#x6982;&#x5FF5;:</p>
<ul>
<li>&#x6570;&#x636E;&#x5E93;&#xFF1A;&#x6570;&#x636E;&#x5E93;&#x662F;&#x6240;&#x6709;&#x76F8;&#x5173;&#x6570;&#x636E;&#x7684;&#x57FA;&#x672C;&#x5BB9;&#x5668;&#x3002;&#x5728;&#x540C;&#x6E90;&#x7B56;&#x7565;&#xFF08; &#x534F;&#x8BAE; + &#x57DF;&#x540D; + &#x7AEF;&#x53E3; &#xFF09;&#x7684;&#x524D;&#x63D0;&#x4E0B;&#xFF0C;&#x6BCF;&#x4E2A;&#x57DF;&#x540D;&#x4E0B;&#x53EF;&#x4EE5;&#x65B0;&#x5EFA;&#x4EFB;&#x610F;&#x591A;&#x7684;&#x6570;&#x636E;&#x5E93;&#x3002;IndexedDB &#x4E2D;&#x6709;&#x7248;&#x672C;&#x6982;&#x5FF5;&#xFF0C;&#x8FD9;&#x5C31;&#x89C4;&#x5B9A;&#x4E86;&#x540C;&#x4E00;&#x65F6;&#x523B;&#x4E0B;&#x53EA;&#x6709;&#x4E00;&#x4E2A;&#x7248;&#x672C;&#x7684;&#x6570;&#x636E;&#x5E93;&#x5B58;&#x5728;&#x3002;</li>
<li>&#x5BF9;&#x8C61;&#x4ED3;&#x5E93;&#xFF1A;&#x5BF9;&#x8C61;&#x4ED3;&#x5E93; ObjectStore &#x5728; IndexedDB &#x4E2D;&#x5BF9;&#x5E94;&#x7684;&#x662F; MYSQL &#x4E2D;&#x7684;&#x8868; Table&#x3002;</li>
<li>&#x6570;&#x636E;&#xFF1A;&#x5BF9;&#x8C61;&#x4ED3;&#x5E93;&#x4E2D;&#x8BB0;&#x5F55;&#x7684;&#x662F;&#x82E5;&#x5E72;&#x6761;&#x6570;&#x636E;&#xFF0C;&#x6570;&#x636E;&#x53EA;&#x6709;&#x4E3B;&#x952E;&#x548C;&#x6570;&#x636E;&#x4F53;&#x4E24;&#x4E2A;&#x90E8;&#x5206;&#xFF0C;&#x4E3B;&#x952E;&#x4E0D;&#x80FD;&#x91CD;&#x590D;&#xFF0C;&#x53EF;&#x4EE5;&#x4E3A;&#x81EA;&#x589E;&#x7684;&#x6574;&#x6570;&#x7F16;&#x53F7;&#x6216;&#x8005;&#x6570;&#x636E;&#x4E2D;&#x6307;&#x5B9A;&#x7684;&#x4E00;&#x4E2A;&#x5C5E;&#x6027;&#x3002;&#x6570;&#x636E;&#x4F53;&#x53EF;&#x4EE5;&#x662F;&#x4EFB;&#x610F;&#x6570;&#x636E;&#x7C7B;&#x578B;&#xFF0C;&#x4E0D;&#x9650;&#x4E8E;&#x5BF9;&#x8C61;&#x3002;</li>
<li>&#x7D22;&#x5F15;&#xFF1A;&#x4E3A;&#x4E0D;&#x540C;&#x7684;&#x5C5E;&#x6027;&#x5EFA;&#x7ACB;&#x7D22;&#x5F15;&#x53EF;&#x4EE5;&#x52A0;&#x5FEB;&#x6570;&#x636E;&#x7684;&#x68C0;&#x7D22;&#x3002;</li>
<li>&#x4E8B;&#x52A1;&#xFF1A;&#x6570;&#x636E;&#x7684; CURD (&#x589E;&#x5220;&#x67E5;&#x6539;) &#x90FD;&#x8981;&#x901A;&#x8FC7;&#x4E8B;&#x52A1;&#x6765;&#x5B8C;&#x6210;&#x3002;</li>
</ul>
<h2 id="&#x5FEB;&#x901F;&#x8D77;&#x6B65;-indexeddb"><a name="&#x5FEB;&#x901F;&#x8D77;&#x6B65;-indexeddb" class="anchor-navigation-ex-anchor" href="#&#x5FEB;&#x901F;&#x8D77;&#x6B65;-indexeddb"><i class="fa fa-link" aria-hidden="true"></i></a>1.3. &#x5FEB;&#x901F;&#x8D77;&#x6B65; IndexedDB</h2>
<p>&#x5728;&#x4ECB;&#x7ECD;&#x4E86; IndexedDB &#x7684;&#x4E3B;&#x8981;&#x6982;&#x5FF5;&#x4E4B;&#x540E;&#xFF0C;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x4E00;&#x4E2A;&#x7B80;&#x5355;&#x5B9E;&#x7528;&#x7684; CURD &#x4F8B;&#x5B50;&#x6765;&#x5B66;&#x4E60;&#x5728;&#x65E5;&#x5E38;&#x5F00;&#x53D1;&#x4E2D;&#x6211;&#x4EEC;&#x662F;&#x600E;&#x4E48;&#x4F7F;&#x7528; IndexedDB &#x7684;&#xFF0C;&#x5404;&#x4E2A; API &#x7EC6;&#x8282;&#x65E5;&#x540E;&#x53EF;&#x4EE5;&#x6162;&#x6162;&#x6DF1;&#x5165;&#x5B66;&#x4E60;&#x3002;</p>
<ol>
<li><p>&#x5FC5;&#x4E0D;&#x53EF;&#x5C11;&#x7684;&#x6D4F;&#x89C8;&#x5668;&#x652F;&#x6301;&#x68C0;&#x67E5;:</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">if</span>(<span class="hljs-string">&apos;indexedDB&apos;</span> <span class="hljs-keyword">in</span> <span class="hljs-built_in">window</span>){
  <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;&#x5F53;&#x524D;&#x6D4F;&#x89C8;&#x5668;&#x652F;&#x6301; IndexedDB&apos;</span>);
  <span class="hljs-keyword">return</span>;
} <span class="hljs-keyword">else</span> {
  <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;&#x60A8;&#x7684;&#x6D4F;&#x89C8;&#x5668;&#x4E0D;&#x652F;&#x6301; IndexedDB&apos;</span>)
  <span class="hljs-comment">// todo &#x5EFA;&#x8BAE;&#x5347;&#x7EA7;&#x6216;&#x8005;&#x66F4;&#x6362;&#x5176;&#x4ED6;&#x6D4F;&#x89C8;&#x5668;</span>
}
</code></pre>
</li>
<li><p>&#x8FDE;&#x63A5;&#x6570;&#x636E;&#x5E93;</p>
<pre><code class="lang-javascript"><span class="hljs-comment">// &#x6570;&#x636E;&#x5E93;&#x5B9E;&#x4F8B;</span>
 <span class="hljs-keyword">let</span> dbInstance;
 <span class="hljs-comment">// &#x6570;&#x636E;&#x5E93;&#x6253;&#x5F00;&#x64CD;&#x4F5C;&#xFF0C;&#x7B2C;&#x4E00;&#x4E2A;&#x53C2;&#x6570;&#x662F;&#x6570;&#x636E;&#x5E93;&#x540D;&#x79F0;, &#x7B2C;&#x4E8C;&#x4E2A;&#x53C2;&#x6570;&#x662F;&#x6570;&#x636E;&#x5E93;&#x7248;&#x672C;</span>
 <span class="hljs-keyword">let</span> DBRequestLink = <span class="hljs-built_in">window</span>.indexedDB.open(<span class="hljs-string">&apos;dataBaseName&apos;</span>, <span class="hljs-number">4</span>)
 DBRequestLink.onsuccess = <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params">event</span>) </span>{
   <span class="hljs-comment">// &#x83B7;&#x53D6;&#x6570;&#x636E;&#x5E93;&#x5B9E;&#x4F8B;</span>
   dbInstance = DBRequestLink.result;
   <span class="hljs-comment">// &#x5176;&#x4ED6;&#x64CD;&#x4F5C;</span>
 };
 <span class="hljs-comment">// &#x8FD9;&#x4E2A;&#x76D1;&#x542C;&#x56DE;&#x8C03;&#x89E6;&#x53D1;&#x4E8E;&#x6570;&#x636E;&#x5E93;&#x9996;&#x6B21;&#x65B0;&#x5EFA;&#x3001;open&#x6570;&#x636E;&#x5E93;&#x65F6;&#x4F20;&#x9012;&#x65B0;&#x7248;&#x672C;(&#x53EA;&#x80FD;&#x6BD4;&#x4E4B;&#x524D;&#x4F20;&#x9012;&#x7684;&#x7248;&#x672C;&#x9AD8;)</span>
 DBRequestLink.onupgradeneeded = <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params">event</span>) </span>{};
</code></pre>
</li>
<li><p>&#x521B;&#x5EFA;&#x6570;&#x636E;&#x5E93;&#x7684;&#x4E3B;&#x952E;&#x548C;&#x5B57;&#x6BB5;</p>
<pre><code class="lang-javascript">DBOpenRequest.onupgradeneeded = <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params">event</span>) </span>{
   <span class="hljs-keyword">let</span> db = event.target.result;

   <span class="hljs-comment">// &#x521B;&#x5EFA;&#x4E00;&#x4E2A;&#x6570;&#x636E;&#x5E93;&#x5B58;&#x50A8;&#x5BF9;&#x8C61;&#xFF0C;&#x5E76;&#x6307;&#x5B9A;&#x4E3B;&#x952E;</span>
   <span class="hljs-keyword">let</span> objectStore = db.createObjectStore(<span class="hljs-string">&apos;person&apos;</span>, { 
     <span class="hljs-attr">keyPath</span>: <span class="hljs-string">&apos;id&apos;</span>,
     <span class="hljs-attr">autoIncrement</span>: <span class="hljs-literal">true</span>
   });

   <span class="hljs-comment">/* &#x5B9A;&#x4E49;&#x5B58;&#x50A8;&#x5BF9;&#x8C61;&#x7684;&#x6570;&#x636E;&#x9879; 
    * &#x7B2C;&#x4E00;&#x4E2A;&#x53C2;&#x6570;&#x662F;&#x521B;&#x5EFA;&#x7684;&#x7D22;&#x5F15;&#x540D;&#x79F0;&#xFF0C;&#x53EF;&#x4EE5;&#x4E3A;&#x7A7A;
    * &#x7B2C;&#x4E8C;&#x4E2A;&#x53C2;&#x6570;&#x662F;&#x7D22;&#x5F15;&#x4F7F;&#x7528;&#x7684;&#x5173;&#x952E;&#x540D;&#x79F0;&#xFF0C;&#x53EF;&#x4EE5;&#x4E3A;&#x7A7A;
    * &#x7B2C;&#x4E09;&#x4E2A;&#x53C2;&#x6570;&#x662F;&#x53EF;&#x9009;&#x914D;&#x7F6E;&#x53C2;&#x6570;&#xFF0C;&#x53EF;&#x4EE5;&#x4E0D;&#x4F20;&#xFF0C;&#x5E38;&#x7528;&#x53C2;&#x6570;&#x4E4B;&#x4E00;&#x5C31;&#x662F; unique &#xFF0C;&#x8868;&#x793A;&#x8BE5;&#x5B57;&#x6BB5;&#x662F;&#x5426;&#x552F;&#x4E00;&#xFF0C;&#x4E0D;&#x80FD;&#x91CD;&#x590D;
    */</span> 
   objectStore.createIndex(<span class="hljs-string">&apos;id&apos;</span>, <span class="hljs-string">&apos;id&apos;</span>, {
     <span class="hljs-attr">unique</span>: <span class="hljs-literal">true</span>    
   });
   objectStore.createIndex(<span class="hljs-string">&apos;name&apos;</span>, <span class="hljs-string">&apos;name&apos;</span>);
   objectStore.createIndex(<span class="hljs-string">&apos;age&apos;</span>, <span class="hljs-string">&apos;age&apos;</span>);
   objectStore.createIndex(<span class="hljs-string">&apos;sex&apos;</span>, <span class="hljs-string">&apos;sex&apos;</span>);
 };
</code></pre>
<p>&#x5728;&#x4E0A;&#x8FF0;&#x64CD;&#x4F5C;&#x4E2D;&#xFF0C;&#x6211;&#x4EEC;&#x5148;&#x5B9A;&#x4E49;&#x4E86;&#x4E0A;&#x6587;&#x4E2D;&#x63D0;&#x5230;&#x7684; IDBObjectStore &#x5BF9;&#x8C61;&#xFF0C;&#x5E76;&#x6307;&#x5B9A;&#x4E3B;&#x952E;&#x4E3A; id &#xFF0C;&#x968F;&#x540E;&#x53C8;&#x901A;&#x8FC7; createIndex &#x6765;&#x521B;&#x5EFA;&#x5B57;&#x6BB5;&#x3002;&#x503C;&#x5F97;&#x6CE8;&#x610F;&#x7684;&#x662F;&#x867D;&#x7136;&#x521B;&#x5EFA;&#x4E86;&#x56DB;&#x4E2A;&#x5B57;&#x6BB5;&#xFF0C;&#x4F46;&#x5728; IndexedDb &#x4E2D;&#x6570;&#x636E;&#x8FD8;&#x662F;&#x5206;&#x4E3A;&#x4E3B;&#x952E; id &#x548C;&#x6570;&#x636E;&#x4E3B;&#x4F53;&#x4E24;&#x4E2A;&#x90E8;&#x5206;&#xFF0C;&#x5E76;&#x4E0D;&#x4F1A;&#x50CF; MYSQL &#x4E2D;&#x5728; Table &#x4E2D;&#x5448;&#x73B0;&#x56DB;&#x5217;&#x3002;</p>
</li>
</ol>
<ol>
<li><p>&#x5411;&#x6570;&#x636E;&#x5E93;&#x4E2D;&#x6DFB;&#x52A0;&#x6570;&#x636E;</p>
<pre><code class="lang-javascript"><span class="hljs-comment">// &#x8FD9;&#x91CC;&#x7684; dbInstance &#x5C31;&#x662F;&#x7B2C;&#x4E8C;&#x6B65;&#x4E2D;&#x7684; dbInstance &#x5BF9;&#x8C61;&#xFF0C; </span>
 <span class="hljs-comment">// transaction api &#x7684;&#x7B2C;&#x4E00;&#x4E2A;&#x53C2;&#x6570;&#x662F;&#x6570;&#x636E;&#x5E93;&#x540D;&#x79F0;&#xFF0C;&#x7B2C;&#x4E8C;&#x4E2A;&#x53C2;&#x6570;&#x662F;&#x64CD;&#x4F5C;&#x7C7B;&#x578B;</span>
 <span class="hljs-keyword">let</span> newItem = {
   <span class="hljs-attr">id</span>: <span class="hljs-number">1</span>,
   <span class="hljs-attr">name</span>: <span class="hljs-string">&apos;&#x5F90;&#x563B;&#x563B;&apos;</span>,
   <span class="hljs-attr">age</span>: <span class="hljs-number">3</span>,
   <span class="hljs-attr">sex</span>: <span class="hljs-string">&apos;female&apos;</span>
 };
 <span class="hljs-keyword">let</span> transaction = dbInstance.transaction(<span class="hljs-string">&apos;person&apos;</span>, <span class="hljs-string">&quot;readwrite&quot;</span>);
 <span class="hljs-comment">// &#x627E;&#x5230;&#x5BF9;&#x5E94;&#x7684;&#x5B58;&#x50A8;&#x5BF9;&#x8C61;</span>
 <span class="hljs-keyword">let</span> objectStore = transaction.objectStore(<span class="hljs-string">&apos;person&apos;</span>);
 <span class="hljs-comment">// &#x6DFB;&#x52A0;&#x5230;&#x6570;&#x636E;&#x5BF9;&#x8C61;&#x4E2D;, &#x4F20;&#x5165;javascript&#x5BF9;&#x8C61;</span>
 objectStore.add(newItem);
</code></pre>
<p>&#x65B0;&#x5EFA;&#x64CD;&#x4F5C;&#x662F;&#x5728;&#x65B0;&#x5EFA;&#x4E86;&#x4E00;&#x4E2A; &#x4E8B;&#x52A1;&#xFF08; IDBTransaction &#x5BF9;&#x8C61;&#xFF09;&#x7684;&#x524D;&#x63D0;&#x4E0B;&#x5B8C;&#x6210;&#x7684;&#xFF0C;&#x4F20;&#x5165;&#x7684;&#x6570;&#x636E;&#x4E0D;&#x9700;&#x8981;&#x505A;&#x4EFB;&#x4F55;&#x8F6C;&#x6362;&#xFF0C;&#x53EF;&#x4EE5;&#x65E0;&#x7F1D;&#x4F20;&#x5165; Javascript &#x5BF9;&#x8C61;&#x3002;</p>
</li>
<li><p>&#x4FEE;&#x6539;&#x6570;&#x636E;&#x5E93;&#x4E2D;&#x7684;&#x6570;&#x636E;</p>
<pre><code class="lang-javascript"><span class="hljs-comment">// &#x8FD9;&#x91CC;&#x7684; dbInstance &#x5C31;&#x662F;&#x7B2C;&#x4E8C;&#x6B65;&#x4E2D;&#x7684; dbInstance &#x5BF9;&#x8C61;&#xFF0C; </span>
 <span class="hljs-comment">// &#x65B0;&#x5EFA;&#x4E8B;&#x52A1;</span>
 <span class="hljs-keyword">let</span> transaction = dbInstance.transaction(<span class="hljs-string">&apos;person&apos;</span>, <span class="hljs-string">&quot;readwrite&quot;</span>);
 <span class="hljs-comment">// &#x65B0;&#x6570;&#x636E;&#x4E3B;&#x4F53;</span>
 <span class="hljs-keyword">let</span> newRecord = {
   <span class="hljs-attr">id</span>: <span class="hljs-number">1</span>,
   <span class="hljs-attr">name</span>: <span class="hljs-string">&apos;&#x5F90;&#x560E;&#x560E;&apos;</span>,
   <span class="hljs-attr">age</span>: <span class="hljs-number">5</span>,
   <span class="hljs-attr">sex</span>: <span class="hljs-string">&apos;male&apos;</span>
 };
 <span class="hljs-comment">// &#x6253;&#x5F00;&#x5DF2;&#x7ECF;&#x5B58;&#x50A8;&#x7684;&#x6570;&#x636E;&#x5BF9;&#x8C61;</span>
 <span class="hljs-keyword">let</span> objectStore = transaction.objectStore(<span class="hljs-string">&apos;person&apos;</span>);
 <span class="hljs-comment">// &#x83B7;&#x53D6;&#x5B58;&#x50A8;&#x7684;&#x5BF9;&#x5E94;&#x952E;&#x7684;&#x5B58;&#x50A8;&#x5BF9;&#x8C61;, &#x4F20;&#x5165;&#x4E3B;&#x952E; id&#xFF0C;&#x503C;&#x4E3A; 1  </span>
 <span class="hljs-keyword">let</span> objectStoreRequest = objectStore.get(<span class="hljs-number">1</span>);
 <span class="hljs-comment">// &#x83B7;&#x53D6;&#x6210;&#x529F;&#x540E;&#x66FF;&#x6362;&#x5F53;&#x524D;&#x6570;&#x636E;</span>
 objectStoreRequest.onsuccess = <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params">event</span>) </span>{
   <span class="hljs-comment">// &#x6570;&#x636E;</span>
   <span class="hljs-keyword">var</span> record = objectStoreRequest.result;
   <span class="hljs-comment">// &#x904D;&#x5386;&#x66FF;&#x6362;</span>
   <span class="hljs-keyword">for</span> (<span class="hljs-keyword">let</span> key <span class="hljs-keyword">in</span> newRecord) {
     <span class="hljs-keyword">if</span> (<span class="hljs-keyword">typeof</span> record[key] != <span class="hljs-string">&apos;undefined&apos;</span> || key !== <span class="hljs-string">&apos;id&apos;</span>) {
       record[key] = newRecord[key];
     }
   }
   <span class="hljs-comment">// &#x66F4;&#x65B0;&#x6570;&#x636E;&#x5E93;&#x5B58;&#x50A8;&#x6570;&#x636E;             </span>
   objectStore.put(record);
 };
</code></pre>
<p>&#x57FA;&#x672C;&#x601D;&#x8DEF;&#x662F;&#x521B;&#x5EFA;&#x4E00;&#x4E2A;&#x4E8B;&#x52A1;&#xFF0C;&#x5148;&#x627E;&#x5230;&#x60F3;&#x8981;&#x4FEE;&#x6539;&#x7684;&#x6570;&#x636E;&#x4E3B;&#x4F53;&#xFF0C;&#x7136;&#x540E;&#x5728;&#x66F4;&#x65B0;&#x8BE5;&#x6570;&#x636E;&#x4E3B;&#x4F53;&#x5185;&#x5BB9;&#x3002; &#x4E8B;&#x52A1;&#x521B;&#x5EFA;&#x903B;&#x8F91;&#x76F8;&#x540C;&#xFF0C;&#x5E76;&#x5728;&#x521B;&#x5EFA;&#x4E4B;&#x540E;&#x8C03;&#x7528;&#x4E8B;&#x52A1;&#x7684; get &#x548C; put &#x64CD;&#x4F5C;&#x3002;</p>
</li>
<li><p>&#x5220;&#x9664;&#x6570;&#x636E;&#x5E93;&#x4E2D;&#x7684;&#x6570;&#x636E;</p>
<pre><code class="lang-javascript"><span class="hljs-comment">// &#x8FD9;&#x91CC;&#x7684; dbInstance &#x5C31;&#x662F;&#x7B2C;&#x4E8C;&#x6B65;&#x4E2D;&#x7684; dbInstance &#x5BF9;&#x8C61;&#xFF0C; </span>
 <span class="hljs-comment">// &#x65B0;&#x5EFA;&#x4E8B;&#x52A1;</span>
 <span class="hljs-keyword">let</span> transaction = dbInstance.transaction(<span class="hljs-string">&apos;person&apos;</span>, <span class="hljs-string">&quot;readwrite&quot;</span>);
 <span class="hljs-comment">// &#x6253;&#x5F00;&#x5DF2;&#x7ECF;&#x5B58;&#x50A8;&#x7684;&#x6570;&#x636E;&#x5BF9;&#x8C61;</span>
 <span class="hljs-keyword">let</span> objectStore = transaction.objectStore(<span class="hljs-string">&apos;person&apos;</span>);
 <span class="hljs-comment">// &#x83B7;&#x53D6;&#x5B58;&#x50A8;&#x7684;&#x5BF9;&#x5E94;&#x952E;&#x7684;&#x5B58;&#x50A8;&#x5BF9;&#x8C61;, &#x4F20;&#x5165;&#x4E3B;&#x952E; id&#xFF0C;&#x503C;&#x4E3A; 1  </span>
 <span class="hljs-keyword">let</span> objectStoreRequest = objectStore.delete(<span class="hljs-number">1</span>);
</code></pre>
<p>&#x8C03;&#x7528; delete &#x63A5;&#x53E3;&#xFF0C;&#x4F20;&#x5165;&#x6307;&#x5B9A;&#x7684; id &#x5373;&#x53EF;&#x3002;</p>
</li>
</ol>
<h2 id="&#x53EF;&#x4EE5;&#x63D0;&#x6548;&#x7684;&#x7C7B;&#x5E93;"><a name="&#x53EF;&#x4EE5;&#x63D0;&#x6548;&#x7684;&#x7C7B;&#x5E93;" class="anchor-navigation-ex-anchor" href="#&#x53EF;&#x4EE5;&#x63D0;&#x6548;&#x7684;&#x7C7B;&#x5E93;"><i class="fa fa-link" aria-hidden="true"></i></a>1.4. &#x53EF;&#x4EE5;&#x63D0;&#x6548;&#x7684;&#x7C7B;&#x5E93;</h2>
<p>&#x200B;    &#x4ECE;&#x4E0A;&#x9762;&#x7684;&#x4F8B;&#x5B50;&#x4E2D;&#x53EF;&#x4EE5;&#x770B;&#x51FA;&#xFF0C;&#x6BCF;&#x4E00;&#x6B21;&#x64CD;&#x4F5C;&#x9700;&#x8981;&#x81F3;&#x5C11;&#x4E09;&#x884C;&#x4EE3;&#x7801;&#x624D;&#x80FD;&#x5B8C;&#x6210;&#xFF0C;&#x800C;&#x4E14;&#x9700;&#x8981;&#x4E00;&#x76F4;&#x7EF4;&#x62A4; DB &#x7684;&#x5BF9;&#x8C61;&#x5F15;&#x7528;&#xFF0C;&#x907F;&#x514D;&#x5B83;&#x88AB;&#x56DE;&#x6536;&#xFF0C;&#x8FD9;&#x6837;&#x5B50;&#x5F00;&#x53D1;&#x4EE3;&#x7801;&#x81A8;&#x80C0;&#x5F97;&#x592A;&#x5389;&#x5BB3;&#xFF0C;&#x6240;&#x4EE5;&#x6211;&#x4EEC;&#x5728;&#x4E1A;&#x52A1;&#x4E2D;&#x5F15;&#x5165;&#x5176;&#x4ED6;&#x7C7B;&#x5E93;&#x6765;&#x51CF;&#x5C11;&#x4EE3;&#x7801;&#x91CF;</p>
<ul>
<li>LocalForage<ul>
<li>&#x53EF;&#x4EE5;&#x6307;&#x5B9A;&#x6570;&#x636E;&#x5B58;&#x50A8;&#x65B9;&#x6848;&#xFF0C;&#x9ED8;&#x8BA4;&#x4F9D;&#x6B21;&#x4E3A; IndexedDB&#x3001;WebSQL&#x3001;LocalStorage&#xFF0C;&#x610F;&#x5473;&#x7740;&#x5F53;&#x524D; IndexedDB &#x5931;&#x6548;&#x53EF;&#x4EE5;&#x6709;&#x515C;&#x5E95;&#x63AA;&#x65BD;&#x3002;</li>
<li>API &#x7B80;&#x5316;&#x4E3A; CRUD ( getItem&#x3001;removeItem&#x3001;setItem&#x3001;clear )</li>
<li>&#x5E93;&#x5927;&#x5C0F;&#x4E3A; 475b</li>
</ul>
</li>
<li>Pouchdb<ul>
<li>API &#x7B80;&#x5316;&#x4E3A; put&#x3001;get&#x3001;remove&#xFF0C;&#x57FA;&#x4E8E; promise &#x6765;&#x68C0;&#x67E5;&#x56DE;&#x6536;&#x9519;&#x8BEF;</li>
<li>&#x6709;&#x8F83;&#x597D;&#x7684;&#x9519;&#x8BEF;&#x65E5;&#x5FD7;&#x673A;&#x5236;&#xFF0C; &#x5982;&#x5931;&#x8D25;&#xFF0C;&#x51B2;&#x7A81;&#x7B49;&#x7B49;&#xFF0C;&#x65B9;&#x4FBF;&#x8C03;&#x8BD5;</li>
<li>&#x5E93;&#x5927;&#x5C0F;&#x4E3A; 255b</li>
</ul>
</li>
</ul>
<p>&#x8FD9;&#x4E24;&#x4E2A;&#x7C7B;&#x5E93;&#x6BD4;&#x8F83;&#x7B26;&#x5408;&#x6211;&#x4EEC;&#x7684;&#x5F00;&#x53D1;&#x8981;&#x6C42;&#xFF0C;&#x6211;&#x4EEC;&#x5F53;&#x524D;&#x4F7F;&#x7528;&#x7684;&#x662F; LocalForage&#x3002;</p>
<h2 id="&#x7ED3;&#x675F;&#x8BED;"><a name="&#x7ED3;&#x675F;&#x8BED;" class="anchor-navigation-ex-anchor" href="#&#x7ED3;&#x675F;&#x8BED;"><i class="fa fa-link" aria-hidden="true"></i></a>1.5. &#x7ED3;&#x675F;&#x8BED;</h2>
<p>&#x5728;&#x4E1A;&#x52A1;&#x5F00;&#x53D1;&#x4E2D;&#xFF0C;&#x6211;&#x4EEC;&#x90FD;&#x4F1A;&#x78B0;&#x5230;&#x6216;&#x591A;&#x6216;&#x5C11;&#x7684;&#x672C;&#x5730;&#x5B58;&#x50A8;&#x9700;&#x6C42;&#xFF0C;&#x672C;&#x6587;&#x4ECB;&#x7ECD;&#x4E86;&#x5176;&#x4E2D;&#x4E00;&#x79CD;&#x5B58;&#x50A8;&#x65B9;&#x6848; IndexedDB &#x7684;&#x7B80;&#x5355;&#x5B9E;&#x8DF5;&#x3002;&#x5C31;&#x6211;&#x4EEC;&#x7684;&#x5E94;&#x7528;&#x573A;&#x666F;&#x6765;&#x770B;&#xFF0C;IndexedDB &#x7684;&#x9002;&#x7528;&#x9762;&#x8FD8;&#x662F;&#x5F88;&#x5E7F;&#x7684;&#x3002;&#x8003;&#x8651;&#x5230; IE10 &#x4E5F;&#x53EF;&#x4EE5;&#x652F;&#x6301;&#xFF0C;&#x628A;&#x5B83;&#x5B9E;&#x8DF5;&#x5728;&#x5B9E;&#x9645;&#x9879;&#x76EE;&#x4E2D;&#x5E94;&#x8BE5;&#x662F;&#x6CA1;&#x6709;&#x95EE;&#x9898;&#x7684;&#x3002; </p>
<footer class="page-footer"><span class="copyright">Copyright &#xA9; zhengyuliang all right reserved&#xFF0C;powered by Gitbook</span><span class="footer-modification">&#x8BE5;&#x6587;&#x4EF6;&#x7F16;&#x5199;&#x65F6;&#x95F4;&#xFF1A;
2021-05-21 10:55:27
</span></footer></body></html>
                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="../CSS/自适应 flex grid.html" class="navigation navigation-prev " aria-label="Previous page: 自适应 Flex Grid">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="../Vue/7个有用的Vue开发技巧.html" class="navigation navigation-next " aria-label="Next page: 7个有用的Vue开发技巧">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"浏览器里的本地数据库：IndexedDB","level":"2.1","depth":1,"next":{"title":"7个有用的Vue开发技巧","level":"3.1","depth":1,"path":"Vue/7个有用的Vue开发技巧.md","ref":"Vue/7个有用的Vue开发技巧.md","articles":[]},"previous":{"title":"自适应 Flex Grid","level":"1.4","depth":1,"path":"CSS/自适应 flex grid.md","ref":"CSS/自适应 flex grid.md","articles":[]},"dir":"ltr"},"config":{"plugins":["sectionx","splitter","tbfed-pagefooter","toggle-chapters","theme-comscore","-lunr","-search","search-plus","donate","anchor-navigation-ex","expandable-chapters","chapter-fold","expandable-chapters-small","livereload"],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"tbfed-pagefooter":{"copyright":"Copyright &copy zhengyuliang","modify_label":"该文件编写时间：","modify_format":"YYYY-MM-DD HH:mm:ss"},"chapter-fold":{},"pluginsConfig":{"anchor-navigation-ex":{"showLevel":false,"showGoTop":true,"isRewritePageTitle":true,"isShowTocTitleIcon":true,"tocLevel1Icon":"fa fa-hand-o-right","tocLevel2Icon":"fa fa-hand-o-right","tocLevel3Icon":"fa fa-hand-o-right"}},"livereload":{},"splitter":{},"donate":{"title":"","button":"赏","wechat":"https://gitee.com/htzyl/img_bed/raw/master/pay/weixin-min.jpg","alipay":"https://gitee.com/htzyl/img_bed/raw/master/pay/alipay-min.jpg","wechatText":"微信打赏","alipayText":"支付宝打赏"},"fontsettings":{"theme":"white","family":"sans","size":2},"sectionx":{"tag":"b"},"highlight":{},"anchor-navigation-ex":{"showLevel":true,"associatedWithSummary":true,"mode":"float","showGoTop":true,"printLog":false,"multipleH1":true,"float":{"floatIcon":"fa fa-navicon","showLevelIcon":false,"level1Icon":"","level2Icon":"","level3Icon":""},"pageTop":{"showLevelIcon":false,"level1Icon":"","level2Icon":"","level3Icon":""}},"theme-comscore":{},"expandable-chapters-small":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"toggle-chapters":{},"expandable-chapters":{},"search-plus":{}},"theme":"default","author":"zhengyuliang","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"记录技术文档内容","language":"zh-hans","gitbook":">=3.0.0","description":"记录Gitbook的配置和一些插件的使用","theme-default":{"showLevel":true}},"file":{"path":"HTML/浏览器里的本地数据库：IndexedDB.md","mtime":"2021-05-21T02:55:27.037Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2022-01-06T09:44:01.178Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-sectionx/sectionx.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-splitter/splitter.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-toggle-chapters/toggle.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search-plus/jquery.mark.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search-plus/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-donate/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-chapter-fold/chapter-fold.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-expandable-chapters-small/expandable-chapters-small.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-livereload/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-theme-comscore/test.js"></script>
        
    

    </body>
</html>

